@dss-kit/ui-kit 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/controls/MarkdownTextEditor/MarkdownTextEditor.js +6 -6
- package/dist/components/shared/MarkdownText/MarkdownText.js +10 -10
- package/dist/components/shared/MarkdownText/MarkdownText.styles.js +28 -44
- package/dist/styles/utils/typography/_variants.scss +3 -16
- package/dist/styles/utils/typography.js +7 -6
- package/dist/styles/utils/typography.ts +5 -4
- package/dist/ui-kit.cjs +8 -8
- package/package.json +1 -1
|
@@ -8,10 +8,10 @@ import { MarkdownShortcutPlugin as U } from "@lexical/react/LexicalMarkdownShort
|
|
|
8
8
|
import { OnChangePlugin as W } from "@lexical/react/LexicalOnChangePlugin";
|
|
9
9
|
import { TablePlugin as H } from "@lexical/react/LexicalTablePlugin";
|
|
10
10
|
import { useState as u, useMemo as a, useCallback as p } from "react";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { getEditorConfig as K } from "./configs/editor.config.js";
|
|
12
|
+
import { MARKDOWN_TOOLBAR_DEFAULT_ACTIONS as q } from "./MarkdownTextEditor.const.js";
|
|
13
|
+
import { MarkdownTextEditorLocaleProvider as z } from "./MarkdownTextEditor.locale.js";
|
|
13
14
|
import { EDITOR_TRANSFORMERS as g } from "./transformers/index.js";
|
|
14
|
-
import { getEditorConfig as z } from "./configs/editor.config.js";
|
|
15
15
|
import { EditorStateContext as G } from "./contexts/EditorStateContext/EditorStateContext.js";
|
|
16
16
|
import { ToolbarContext as J } from "./contexts/ToolbarContext/ToolbarContext.js";
|
|
17
17
|
import { EditorToolbar as Q } from "./components/EditorToolbar/EditorToolbar.js";
|
|
@@ -40,7 +40,7 @@ function Ao({
|
|
|
40
40
|
fieldClassName: R,
|
|
41
41
|
previewClassName: v
|
|
42
42
|
}) {
|
|
43
|
-
const [d, N] = u(""), [i, A] = u(!1), { availableActions: s, onImagesUpload: _ } = b || {}, O = a(() =>
|
|
43
|
+
const [d, N] = u(""), [i, A] = u(!1), { availableActions: s, onImagesUpload: _ } = b || {}, O = a(() => K(), []), I = a(
|
|
44
44
|
() => ({
|
|
45
45
|
isEditable: !m,
|
|
46
46
|
isPreviewMode: i,
|
|
@@ -49,7 +49,7 @@ function Ao({
|
|
|
49
49
|
}),
|
|
50
50
|
[m, i, d]
|
|
51
51
|
), L = a(() => ({
|
|
52
|
-
availableActions: s ||
|
|
52
|
+
availableActions: s || q
|
|
53
53
|
}), [s]), f = p(
|
|
54
54
|
(t) => {
|
|
55
55
|
N(t), r.onMarkdownChange && r.onMarkdownChange(t);
|
|
@@ -64,7 +64,7 @@ function Ao({
|
|
|
64
64
|
},
|
|
65
65
|
[f, r]
|
|
66
66
|
);
|
|
67
|
-
return /* @__PURE__ */ o(
|
|
67
|
+
return /* @__PURE__ */ o(z, { locale: M, children: /* @__PURE__ */ o(V, { initialConfig: O, children: /* @__PURE__ */ o(G.Provider, { value: I, children: /* @__PURE__ */ c(J.Provider, { value: L, children: [
|
|
68
68
|
/* @__PURE__ */ c(
|
|
69
69
|
h,
|
|
70
70
|
{
|
|
@@ -6,11 +6,11 @@ import { ContentEditable as f } from "@lexical/react/LexicalContentEditable";
|
|
|
6
6
|
import { LexicalErrorBoundary as c } from "@lexical/react/LexicalErrorBoundary";
|
|
7
7
|
import { RichTextPlugin as p } from "@lexical/react/LexicalRichTextPlugin";
|
|
8
8
|
import { useMemo as s } from "react";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { getEditorConfig as u } from "../../controls/MarkdownTextEditor/configs/editor.config.js";
|
|
10
|
+
import { EDITOR_TRANSFORMERS as x } from "../../controls/MarkdownTextEditor/transformers/index.js";
|
|
11
|
+
import { markdownTextStyle as w } from "./MarkdownText.styles.js";
|
|
12
|
+
import { Text as E } from "../../builders/Text/Text.js";
|
|
13
|
+
import { EditorStateContext as k } from "../../controls/MarkdownTextEditor/contexts/EditorStateContext/EditorStateContext.js";
|
|
14
14
|
function F({
|
|
15
15
|
markdown: t,
|
|
16
16
|
className: i,
|
|
@@ -27,15 +27,15 @@ function F({
|
|
|
27
27
|
}),
|
|
28
28
|
[r]
|
|
29
29
|
);
|
|
30
|
-
return r ? /* @__PURE__ */ o(
|
|
30
|
+
return r ? /* @__PURE__ */ o(k.Provider, { value: a, children: /* @__PURE__ */ o(
|
|
31
31
|
d,
|
|
32
32
|
{
|
|
33
33
|
initialConfig: {
|
|
34
|
-
...
|
|
34
|
+
...u(),
|
|
35
35
|
editable: !1,
|
|
36
36
|
namespace: "ui-kit-markdown-text-viewer",
|
|
37
37
|
editorState: () => {
|
|
38
|
-
l(r,
|
|
38
|
+
l(r, x);
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
children: /* @__PURE__ */ o(
|
|
@@ -44,7 +44,7 @@ function F({
|
|
|
44
44
|
contentEditable: /* @__PURE__ */ o(
|
|
45
45
|
f,
|
|
46
46
|
{
|
|
47
|
-
className: m(
|
|
47
|
+
className: m(w, i),
|
|
48
48
|
"aria-placeholder": "markdown text",
|
|
49
49
|
placeholder: () => null
|
|
50
50
|
}
|
|
@@ -56,7 +56,7 @@ function F({
|
|
|
56
56
|
},
|
|
57
57
|
r
|
|
58
58
|
) }) : typeof e == "string" ? /* @__PURE__ */ o(
|
|
59
|
-
|
|
59
|
+
E,
|
|
60
60
|
{
|
|
61
61
|
variant: "body-2",
|
|
62
62
|
colorName: "tertiary",
|
|
@@ -1,90 +1,74 @@
|
|
|
1
|
-
import { css as
|
|
1
|
+
import { css as r } from "@emotion/css";
|
|
2
2
|
import { typography as e } from "../../../styles/utils/typography.js";
|
|
3
3
|
import { theme as l } from "../../../utils/theme/index.js";
|
|
4
|
-
const { color:
|
|
4
|
+
const { color: t, cornerRadius: a, spacing: o } = l, c = r({
|
|
5
5
|
width: "100%",
|
|
6
6
|
cursor: "default",
|
|
7
7
|
userSelect: "text",
|
|
8
8
|
outline: "none",
|
|
9
9
|
...e.body2,
|
|
10
|
-
color:
|
|
10
|
+
color: t.text.primary,
|
|
11
11
|
overflowWrap: "anywhere",
|
|
12
12
|
"p, ul, ol, pre, blockquote, table": {
|
|
13
|
-
margin: `${
|
|
13
|
+
margin: `${o.sm} 0`
|
|
14
14
|
},
|
|
15
15
|
"h1, h2, h3, h4, h5, h6": {
|
|
16
|
-
margin: `${
|
|
16
|
+
margin: `${o.md} 0 ${o.sm}`,
|
|
17
17
|
fontWeight: 600
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
h3: {
|
|
28
|
-
fontSize: e.title3.fontSize,
|
|
29
|
-
lineHeight: e.title3.lineHeight
|
|
30
|
-
},
|
|
31
|
-
h4: {
|
|
32
|
-
fontSize: e.headline2.fontSize,
|
|
33
|
-
lineHeight: e.headline2.lineHeight
|
|
34
|
-
},
|
|
35
|
-
h5: {
|
|
36
|
-
fontSize: e.headline3.fontSize,
|
|
37
|
-
lineHeight: e.headline3.lineHeight
|
|
38
|
-
},
|
|
39
|
-
h6: {
|
|
40
|
-
fontSize: e.body1.fontSize,
|
|
41
|
-
lineHeight: e.body1.lineHeight
|
|
42
|
-
},
|
|
19
|
+
// Токены целиком, а не только fontSize/lineHeight: вместе с ними приходят и адаптивные
|
|
20
|
+
// размеры (title-1 ниже 768px), как у <Text variant>.
|
|
21
|
+
h1: { ...e.title1 },
|
|
22
|
+
h2: { ...e.title2 },
|
|
23
|
+
h3: { ...e.title3 },
|
|
24
|
+
h4: { ...e.headline2 },
|
|
25
|
+
h5: { ...e.headline3 },
|
|
26
|
+
h6: { ...e.body1 },
|
|
43
27
|
ul: {
|
|
44
|
-
paddingLeft:
|
|
28
|
+
paddingLeft: o.xl,
|
|
45
29
|
listStyleType: "disc"
|
|
46
30
|
},
|
|
47
31
|
ol: {
|
|
48
|
-
paddingLeft:
|
|
32
|
+
paddingLeft: o.xl,
|
|
49
33
|
listStyleType: "decimal"
|
|
50
34
|
},
|
|
51
35
|
li: {
|
|
52
|
-
margin: `${
|
|
36
|
+
margin: `${o.xs} 0`
|
|
53
37
|
},
|
|
54
38
|
a: {
|
|
55
|
-
color:
|
|
39
|
+
color: t.text.accent,
|
|
56
40
|
textDecoration: "underline"
|
|
57
41
|
},
|
|
58
42
|
code: {
|
|
59
|
-
padding: `0 ${
|
|
60
|
-
borderRadius:
|
|
61
|
-
backgroundColor:
|
|
43
|
+
padding: `0 ${o.xs}`,
|
|
44
|
+
borderRadius: a.xs,
|
|
45
|
+
backgroundColor: t.fill.neutral_secondary,
|
|
62
46
|
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
|
|
63
47
|
},
|
|
64
48
|
"pre code": {
|
|
65
49
|
display: "block",
|
|
66
|
-
padding:
|
|
50
|
+
padding: o.md,
|
|
67
51
|
overflowX: "auto"
|
|
68
52
|
},
|
|
69
53
|
blockquote: {
|
|
70
54
|
marginLeft: 0,
|
|
71
|
-
paddingLeft:
|
|
72
|
-
borderLeft: `3px solid ${
|
|
73
|
-
color:
|
|
55
|
+
paddingLeft: o.md,
|
|
56
|
+
borderLeft: `3px solid ${t.border.neutral_alpha_basic}`,
|
|
57
|
+
color: t.text.secondary
|
|
74
58
|
},
|
|
75
59
|
table: {
|
|
76
60
|
width: "100%",
|
|
77
61
|
borderCollapse: "collapse"
|
|
78
62
|
},
|
|
79
63
|
"th, td": {
|
|
80
|
-
border: `1px solid ${
|
|
81
|
-
padding:
|
|
64
|
+
border: `1px solid ${t.border.neutral_alpha_basic}`,
|
|
65
|
+
padding: o.sm,
|
|
82
66
|
textAlign: "left"
|
|
83
67
|
},
|
|
84
68
|
th: {
|
|
85
|
-
backgroundColor:
|
|
69
|
+
backgroundColor: t.fill.neutral_secondary
|
|
86
70
|
}
|
|
87
71
|
});
|
|
88
72
|
export {
|
|
89
|
-
|
|
73
|
+
c as markdownTextStyle
|
|
90
74
|
};
|
|
@@ -14,36 +14,23 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/* ==== Titles ==== */
|
|
17
|
+
// От ширины экрана зависит только title-1, ссылка на макет со шкалой — в
|
|
18
|
+
// styles/utils/typography.ts (TM-4108). Значения синхронны с typography.ts.
|
|
17
19
|
@mixin title-1 {
|
|
18
20
|
@include text-size(32px, 36px);
|
|
19
21
|
|
|
20
22
|
// md = 768px
|
|
21
23
|
@include breakpoints.bp-md() {
|
|
22
|
-
|
|
24
|
+
@include text-size(28px, 32px);
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
@mixin title-2 {
|
|
27
29
|
@include text-size(24px, 28px);
|
|
28
|
-
|
|
29
|
-
// md = 768px
|
|
30
|
-
@include breakpoints.bp-md() {
|
|
31
|
-
font-size: 20px;
|
|
32
|
-
}
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
@mixin title-3 {
|
|
36
33
|
@include text-size(20px, 28px);
|
|
37
|
-
|
|
38
|
-
// md = 768px
|
|
39
|
-
@include breakpoints.bp-md() {
|
|
40
|
-
font-size: 18px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// xs = 480px
|
|
44
|
-
@include breakpoints.bp-xs() {
|
|
45
|
-
font-size: 16px;
|
|
46
|
-
}
|
|
47
34
|
}
|
|
48
35
|
|
|
49
36
|
/* ==== Headline ==== */
|
|
@@ -4,24 +4,25 @@ const e = {
|
|
|
4
4
|
wordBreak: "break-word"
|
|
5
5
|
}, n = {
|
|
6
6
|
common: e,
|
|
7
|
+
// От ширины экрана зависит только title-1: ниже 768px — 28/32. Остальные варианты
|
|
8
|
+
// одинаковы на всех ширинах. Шкала согласована с дизайнером (TM-4108):
|
|
9
|
+
// https://www.figma.com/design/OL4CCm8EL0IpsfoEeykNHi/?node-id=6408-661
|
|
10
|
+
// Значения синхронны с styles/utils/typography/_variants.scss.
|
|
7
11
|
title1: {
|
|
8
12
|
...e,
|
|
9
13
|
fontSize: 32,
|
|
10
14
|
lineHeight: "36px",
|
|
11
|
-
[i.md()]: { fontSize:
|
|
15
|
+
[i.md()]: { fontSize: 28, lineHeight: "32px" }
|
|
12
16
|
},
|
|
13
17
|
title2: {
|
|
14
18
|
...e,
|
|
15
19
|
fontSize: 24,
|
|
16
|
-
lineHeight: "28px"
|
|
17
|
-
[i.md()]: { fontSize: 20 }
|
|
20
|
+
lineHeight: "28px"
|
|
18
21
|
},
|
|
19
22
|
title3: {
|
|
20
23
|
...e,
|
|
21
24
|
fontSize: 20,
|
|
22
|
-
lineHeight: "28px"
|
|
23
|
-
[i.md()]: { fontSize: 18 },
|
|
24
|
-
[i.xs()]: { fontSize: 16 }
|
|
25
|
+
lineHeight: "28px"
|
|
25
26
|
},
|
|
26
27
|
headline1: {
|
|
27
28
|
...e,
|
|
@@ -8,26 +8,27 @@ const common = {
|
|
|
8
8
|
export const typography = {
|
|
9
9
|
common,
|
|
10
10
|
|
|
11
|
+
// От ширины экрана зависит только title-1: ниже 768px — 28/32. Остальные варианты
|
|
12
|
+
// одинаковы на всех ширинах. Шкала согласована с дизайнером (TM-4108):
|
|
13
|
+
// https://www.figma.com/design/OL4CCm8EL0IpsfoEeykNHi/?node-id=6408-661
|
|
14
|
+
// Значения синхронны с styles/utils/typography/_variants.scss.
|
|
11
15
|
title1: {
|
|
12
16
|
...common,
|
|
13
17
|
fontSize: 32,
|
|
14
18
|
lineHeight: "36px",
|
|
15
|
-
[bp.md()]: { fontSize:
|
|
19
|
+
[bp.md()]: { fontSize: 28, lineHeight: "32px" },
|
|
16
20
|
},
|
|
17
21
|
|
|
18
22
|
title2: {
|
|
19
23
|
...common,
|
|
20
24
|
fontSize: 24,
|
|
21
25
|
lineHeight: "28px",
|
|
22
|
-
[bp.md()]: { fontSize: 20 },
|
|
23
26
|
},
|
|
24
27
|
|
|
25
28
|
title3: {
|
|
26
29
|
...common,
|
|
27
30
|
fontSize: 20,
|
|
28
31
|
lineHeight: "28px",
|
|
29
|
-
[bp.md()]: { fontSize: 18 },
|
|
30
|
-
[bp.xs()]: { fontSize: 16 },
|
|
31
32
|
},
|
|
32
33
|
|
|
33
34
|
headline1: {
|